﻿<RibbonWindow x:Class="GeoCoder.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:GeoCoder"
              Title="Rapid GeoCoder" Height="768" Width="1024" Icon="Images/globe.png">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition/>
            <RowDefinition Height="2*"/>
        </Grid.RowDefinitions>
        <Ribbon x:Name="RibbonWin"  SelectedIndex="0">
            <Ribbon.HelpPaneContent>
                <RibbonButton SmallImageSource="Images\help.png" Click="HelpRibbonButtonClick"/>
            </Ribbon.HelpPaneContent>
            <Ribbon.ApplicationMenu>
                <RibbonApplicationMenu KeyTip="F">
                    <RibbonApplicationMenuItem Header="Exit" ImageSource="Images\quit.png" Click="ShutdownRibbonApplicationMenuItemClick" />
                </RibbonApplicationMenu>
            </Ribbon.ApplicationMenu>
            <RibbonTab Header="Search">
                <RibbonGroup Header="What?">
                    <RibbonTextBox x:Name="WhatTextBox" Text="Billa" TextBoxWidth="150" Label="Search for" LargeImageSource="Images\search.png"/>
                </RibbonGroup>
                <RibbonGroup Header="Where?">
                    <local:RibbonComboBoxFocusFix x:Name="WhereComboBox" LargeImageSource="Images\globe.png" SelectionBoxWidth="150" Label="in" IsEditable="True" >
                        <RibbonGallery SelectedValue="Wien" SelectedValuePath="Content" MaxColumnCount="1">
                            <RibbonGalleryCategory>
                                <RibbonGalleryItem Content="Burgenland" />
                                <RibbonGalleryItem Content="Kärnten" />
                                <RibbonGalleryItem Content="Niederösterreich" />
                                <RibbonGalleryItem Content="Oberösterreich" />
                                <RibbonGalleryItem Content="Salzburg" />
                                <RibbonGalleryItem Content="Steiermark" />
                                <RibbonGalleryItem Content="Tirol" />
                                <RibbonGalleryItem Content="Vorarlberg" />
                                <RibbonGalleryItem Content="Wien" />
                            </RibbonGalleryCategory>
                        </RibbonGallery>
                    </local:RibbonComboBoxFocusFix>
                </RibbonGroup>
                <RibbonGroup Header="Search">
                    <RibbonGroup Header="Source">
                        <RibbonRadioButton Label="Yellow Pages" IsChecked="True" GroupName="searchType" Content="yp" />
                        <RibbonRadioButton Label="Phone Book" GroupName="searchType" Content="wp"/>
                        <RibbonRadioButton Label="Both" GroupName="searchType" Content="all"/>
                    </RibbonGroup>
                    <RibbonButton LargeImageSource="Images\start.png" Label="Start searching" Click="StartSearchingRibbonButtonClick" />
                    <RibbonButton Label="Search hint" SmallImageSource="Images\hint.png" Click="SearchHintRibbonButtonClick" />
                </RibbonGroup>
                <RibbonGroup Header="Export">
                    <RibbonMenuButton x:Name="ExportRibbonMenuButton" LargeImageSource="Images\export.png" Label="Export" IsEnabled="False">
                        <RibbonMenuItem Header="Copy to clipboard" ImageSource="Images\clipboard.png" Click="CopyClipboardRibbonMenuItemClick"/>
                        <RibbonMenuItem Header="Export as CSV" ImageSource="Images\excel.png" Click="ExportCsvRibbonMenuItemClick" />
                        <RibbonMenuItem Header="Generate SQL statements" ImageSource="Images\db.png" IsEnabled="False"/>
                    </RibbonMenuButton>
                </RibbonGroup>
                <RibbonGroup Header="Visualization">
                    <RibbonButton x:Name="VisualizeButton" LargeImageSource="Images\pin.png" Label="Visualize results" IsEnabled="False" Click="VisualizeButtonClick" />
                </RibbonGroup>
            </RibbonTab>
            <RibbonTab Header="Settings" KeyTip="S" >
                <RibbonGroup Header="REST API Settings">
                    <RibbonTextBox x:Name="URLTextBox" TextBoxWidth="300" SmallImageSource="Images\url2.png" Text="http://rest.ed.live.golgek.mobi/rest/api/v16/search" Label="URL" />
                    <RibbonTextBox x:Name="ParameterTextBox" TextBoxWidth="262" SmallImageSource="Images\settings2.png" Text="keywords={0}&amp;locations={1}&amp;resultsPerPage={2}&amp;pageNumber={3}&amp;searchType={5}&amp;locale=en_at&amp;showInView=list&amp;clientTime={4}000&amp;applicationType=IPHONE&amp;opco=herold" Label="Parameters" />
                    <RibbonTextBox x:Name="ResultsPerPageTextBox" Text="100" MaxLength="3" Label="Max. results per request" TextBoxWidth="30" SmallImageSource="Images\number.png"/>
                    <RibbonTextBox x:Name="UsernameTextBox" Text="apps" Label="Username" SmallImageSource="Images\user.png" TextBoxWidth="57"/>
                    <RibbonTextBox x:Name="PasswordTextBox" Text="kdj78edd" Label="Password" SmallImageSource="Images\password.png" TextBoxWidth="60"/>
                </RibbonGroup>                
                <RibbonGroup Header="Proxy">
                    <RibbonCheckBox x:Name="ProxyCheckBox" Label="Use Proxy" SmallImageSource="Images\firewall.png"></RibbonCheckBox>
                    <RibbonTextBox x:Name="ProxyAddressTextBox" Label="Proxy Address" SmallImageSource="Images\proxy.png" TextBoxWidth="150" Text="1.1.1.1:8080"></RibbonTextBox>
                    <RibbonTextBox x:Name="ProxyUserTextBox" Label="Username" TextBoxWidth="93"></RibbonTextBox>
                    <WrapPanel Orientation="Horizontal">
                        <Label Content="Password" Height="26"/>
                        <PasswordBox x:Name="ProxyPasswordBox" Width="100" Height="24"/>
                    </WrapPanel>
                </RibbonGroup>
            </RibbonTab>
        </Ribbon>
        <GroupBox Grid.Row="1" Header="Log">
            <TextBox Margin="5" x:Name="LogTextBox" TextWrapping="Wrap"  AcceptsReturn="True" AcceptsTab="True" VerticalScrollBarVisibility="Auto" IsReadOnly="True"/>
        </GroupBox>
        <DataGrid x:Name="ResultsDataGrid" Grid.Row="2" RowBackground="#FFF9F9F9" AlternatingRowBackground="#FFE1EEF4" Background="White" LoadingRow="ResultsDataGridLoadingRow" CanUserAddRows="False" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsVirtualizingWhenGrouping="True">
            <DataGrid.GroupStyle>
                <GroupStyle>
                    <!--<GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding Path=Name}" FontWeight="Bold" FontSize="15"/>
                            </StackPanel>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>-->
                    <GroupStyle.ContainerStyle>
                        <Style TargetType="{x:Type GroupItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type GroupItem}">
                                        <Expander IsExpanded="True">
                                            <Expander.Header>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="{Binding Path=Name}" />
                                                    <TextBlock Text=": " />
                                                    <TextBlock Text="{Binding Path=ItemCount}"/>
                                                    <TextBlock Text=" Results"/>
                                                </StackPanel>
                                            </Expander.Header>
                                            <ItemsPresenter />
                                        </Expander>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </GroupStyle.ContainerStyle>
                </GroupStyle>
            </DataGrid.GroupStyle>
        </DataGrid>
        <local:LoadingControl x:Name="LoadingControl" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Grid>
</RibbonWindow>
